<template>
    <div>
        <div v-for="(role,index) in roleList" :key="index">
            <el-divider>{{role.roleName}}</el-divider>
            <el-button v-for="(menu,_index) in role.menus" :key="_index" type="primary" round @click="toPath(menu.path)">{{menu.name}}</el-button>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                user: this.$store.state.user,
                roleList:[]
            }
        },
        mounted() {
            this.listMenu();
        },
        methods:{
            listMenu(){
                this.$api.yhcd.yhcd({'userid':this.user.id}).then(res => {
                    this.roleList = res.list;
                })
            },
            toPath(path){
                this.$router.push({name:path})
            }
        }
        }
</script>

<style>
</style>
